package com.kk.lesson01;

import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class MyHomeWork {
    public static void main(String[] args) {
        Frame frame = new Frame();
        Button button1 = new Button("button1");//最左边
        Button button2=new Button("button2");//最右边
        Button button3=new Button("button3");//中间
        Button button4=new Button("button4");//中间
        Button button5=new Button("button5");//中间
        Button button6=new Button("button6");//中间
        Button button7=new Button("button7");//中间
        Button button8=new Button("button8");//中间
        Button button9=new Button("button9");//中间
        Button button10=new Button("button10");//中间
        Panel west=new Panel(new GridLayout(2,1));
        Panel east=new Panel(new GridLayout(2,1));
        Panel center = new Panel(new GridLayout(2,1));
        Panel up=new Panel(new GridLayout(2,1));
        Panel down=new Panel(new GridLayout(2,2));

        frame.add(west,BorderLayout.WEST);
        frame.add(east,BorderLayout.EAST);
        frame.add(center,BorderLayout.CENTER);

        west.add(button1);
        west.add(button2);
        center.add(up);
        center.add(down);
        up.add(button3);
        up.add(button4);
        down.add(button5);
        down.add(button6);
        down.add(button7);
        down.add(button8);
        east.add(button9);
        east.add(button10);
        frame.setSize(600,600);
        frame.setVisible(true);
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
    }
}
